<?php
/**
 * Description of Accessories
 *
 * @author TangHienPhong
 */
class AccessoriesService {

    
//    public static function getSerializePrice($model){
//        $model->attributes = unserialize($model->price);
//
//        if($model->real_price != $model->price){
//            echo CHtml::tag('span', array(), Utility::numberFormat($model->price), true);
//            echo CHtml::tag('span', array('style' => 'color: darkred; font-weight:bold; display:block; padding:10px'), "Giảm còn: ".  Utility::numberFormat($model->real_price), true);
//            echo CHtml::tag('span', array(), "Mức chiết khấu: ".$model->discount.$model->type, true);
//        }else{
//            echo CHtml::tag('span', array(), Utility::numberFormat($model->price));
//            if($model->type != "none" && $model->type!="")
//                echo CHtml::tag('span', array('style' => 'font-weight:bold; display:block; padding:10px'), "Mức chiết khấu: ".$model->discount.$model->type, true);
//        }
//    }

    public static function getSerializePrice($model){
        $model->attributes = unserialize($model->price);

        if($model->real_price == 0 && $model->price == 0)
            echo '<span style="color:darkred; font-weight:bold">Đang cập nhật<span>';
        else{
            if($model->real_price != $model->price){
                echo CHtml::tag('span', array(), Utility::numberFormat($model->price), true);
                echo CHtml::tag('span', array('style' => 'color: darkred; font-weight:bold; display:block; padding:10px'), "Giảm còn: ".  Utility::numberFormat($model->real_price), true);
                echo CHtml::tag('span', array(), "Mức chiết khấu: ".$model->discount.$model->type, true);
            }else{
                echo CHtml::tag('span', array(), Utility::numberFormat($model->price));
                if($model->type != "none" && $model->type!="")
                    echo CHtml::tag('span', array('style' => 'font-weight:bold; display:block; padding:10px'), "Mức chiết khấu: ".$model->discount.$model->type, true);
            }
        }

    }

    
}
?>
